﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using MockupDesigner.Items;
using MockupDesigner.AppItems;

namespace MockupDesigner.Editors.TextEditors
{
    public abstract class TextEditorBase : ItemEditor
    {
        protected TextBox element = new TextBox();

        public TextEditorBase()
        {
            base.Element = element;
            this.element.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
            this.element.KeyUp += new System.Windows.Input.KeyEventHandler(element_KeyUp);
            this.element.GotFocus += new RoutedEventHandler(element_GotFocus);
            this.element.LostFocus += new RoutedEventHandler(element_LostFocus);
        }

        public abstract void element_LostFocus(object sender, RoutedEventArgs e);

        public abstract void element_KeyUp(object sender, System.Windows.Input.KeyEventArgs e);

        public void element_GotFocus(object sender, RoutedEventArgs e)
        {
            element.SelectAll();
        }
    }
}
